/*
 * caidat.cpp
 *
 *  Created on: Oct 9, 2014
 *      Author: tanpro
 */
#include "file.h"
void header (tan a,int n,int m)
{
	a.version="eclip luna 4.4";
	a.name="Nguyễn Minh Tân";
	a.col=n;
	a.raw=m;
	ofstream ghi("file.data",ios::binary);
	ghi.write((char *)&a,sizeof(a));
	ghi.close();
}
void doc(tan b)
{
	ifstream doc("file.data",ios::binary);
	doc.read((char*)&b,sizeof(b));
	doc.close();
	cout<<"version : "<<b.version<<"\n";
	cout<<"name : "<<b.name<<"\n";
	cout<<"col : "<<b.col<<"\n";
	cout<<"raw : "<<b.raw<<"\n";
}
void nhapmang(tan c,int n,int m)
{
	int **a;
	a=new int*[n];
	for(int i=0;i<n;i++)
	{
		*(a+i)=new int (m);
	}
	ofstream ghi1("file.data",ios::binary);

	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			cout<<"*(*(a+"<<i<<")+"<<j<<") : ";
			cin>>*(*(a+i)+j);
			c.f[i][j].pt=*(*(a+i)+j);

		}
	}
	ghi1.write((char*)&c,sizeof(c));
	ghi1.close();
	matran e;
	ifstream doc1("file.data",ios::binary);
	doc1.read((char*)&e,sizeof(e));
	doc1.close();
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			cout<<c.f[i][j].pt<<"\t";
		}
		cout<<"\n";
	}

}



